home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hráč 2004 August
/
Hrac_72_2004-08_dvd.iso
/
dema
/
Rapid Gun
/
rg_setup.exe
/
common
/
image_BlackAndWhite.fx
< prev
next >
Wrap
Text File
|
2004-04-21
|
3KB
|
99 lines
// LF2 Engine
// (C) 2002-3 7FX
//---------------------------------------------------------------------------
// Desc
string desc : Description = "Image shader, ktery meni zobrazeni na cerno-bile.";
// Shader type phase
string type : Type = "image";
//---------------------------------------------------------------------------
// Constant for luminance calculation
const float4 cLum = {0.3f, 0.59f, 0.11f, 1.f};
//---------------------------------------------------------------------------
// Render target texture
texture RT : RenderTargetFSMap;
//---------------------------------------------------------------------------
sampler sRT = sampler_state
{
Texture = <RT>;
MinFilter = POINT;
MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
};
//---------------------------------------------------------------------------
// Pixel shader
float4 PS20(float2 uv: TEXCOORD0) : COLOR
{
return dot(tex2D(sRT, uv).rgb, cLum.rgb);
}
//---------------------------------------------------------------------------
// Pixel shader
float4 PS14(float2 uv: TEXCOORD0) : COLOR
{
float4 currFrameSample = tex2D(sRT, uv);
return (currFrameSample.x*cLum.x + currFrameSample.y*cLum.y + currFrameSample.z*cLum.z);
}
//---------------------------------------------------------------------------
technique vs0_ps20
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
PixelShader = compile ps_2_0 PS20();
}
}
//---------------------------------------------------------------------------
technique vs0_ps14
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
PixelShader = compile ps_1_4 PS14();
}
}
//---------------------------------------------------------------------------
technique vs0_ps11
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
Sampler[0] = <sRT>;
PixelShaderConstantF[0] = <cLum>;
PixelShader = asm
{
ps.1.1
tex t0
dp3 r0, t0, c0
};
}
}
//---------------------------------------------------------------------------
// Inaccurate - DotProduct3 uses (-0.5) in all componets, so black is white and white is black
technique vs0_ps0
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
TextureFactor = <cLum>;
Sampler[0] = <sRT>;
ColorOp[0] = DotProduct3;
ColorArg1[0] = Texture;
COlorArg2[0] = TFactor;
AlphaOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
}
}
//---------------------------------------------------------------------------